#include <fstream>
#include <vector>
#include <string>
#include <set>
#include <algorithm>

using namespace std;

class Fraction
{
private:
	__int64 _num;
	__int64 _den;

public:
	Fraction (__int64 num=0, __int64 den=1)
	{
		if (den >0)
		{
			_num = num;
			_den = den;
		}
		else
		{
			_num = -num;
			_den = -den;
		}
	}

	Fraction operator+(const Fraction &rhs)
	{
		__int64 num = _num * rhs._den + _den * rhs._num;
		__int64 den = _den * rhs._den;

		return Fraction (num, den);
	}

	Fraction operator-(const Fraction &rhs)
	{
		__int64 num = _num * rhs._den - _den * rhs._num;
		__int64 den = _den * rhs._den;

		return Fraction (num, den);
	}

	Fraction operator*(const Fraction &rhs)
	{
		__int64 num = _num * rhs._num;
		__int64 den = _den * rhs._den;

		return Fraction (num, den);
	}

	Fraction operator/(const Fraction &rhs)
	{
		__int64 num = _num * rhs._den;
		__int64 den = _den * rhs._num;

		return Fraction (num, den);
	}

	bool operator<(const Fraction &rhs)
	{
		return _num * rhs._den < _den * rhs._num;
	}

	bool operator<= (const Fraction &rhs)
	{
		return _num * rhs._den <= _den * rhs._num;
	}

	bool operator>(const Fraction &rhs)
	{
		return _num * rhs._den > _den * rhs._num;
	}

	bool operator>=(const Fraction &rhs)
	{
		return _num * rhs._den >= _den * rhs._num;
	}

	bool operator==(const Fraction &rhs)
	{
		return _num * rhs._den == _den * rhs._num;
	}

	bool operator!=(const Fraction &rhs)
	{
		return _num * rhs._den != _den * rhs._num;
	}
};

int N, K, B, T;
vector<int>	X;
vector<int>	V;
vector<bool> G;

int CountG ()
{
	G.clear();
	int c =0;

	for (int i=0; i<N; i++)
	{
		Fraction t= ( Fraction(B) -X[i] ) /V[i];
		bool can = (t <= T);
		G.push_back (can);

		if (can)
			c++;
	}

	return c;
}

bool NeedSwap (int idx, int slowIdx)
{
	int d = X[slowIdx] -X[idx];

	if (d<0)
		return false;

	int ds =V[idx] -V[slowIdx];

	Fraction t(d, ds);

	Fraction x =t *V[idx] +X[idx];
	Fraction t2 = (Fraction(B) -x)/V[slowIdx];
	
	return t+t2 > Fraction(T);
}

int CountSwap(int idx)
{
	if (!G[idx])
		return 9999999;

	int swap =0;

	for (int i=0; i<N; i++)
	{
		if (i ==idx || G[i])
			continue;

		if (NeedSwap (idx, i))		
			swap ++;
	}

	return swap;
}

int Solve()
{
	int k = CountG();
	if (k<K)
		return -1;

	vector<int> swap;

	for (int i=0; i<N; i++)
	{
		int s =CountSwap(i);
		swap.push_back(s);
	}

	sort(swap.begin(), swap.end());

	int r =0;

	for (int i=0; i<K; i++)
	{
		r += swap[i];
	}

	return r;
}

void RunB(const char* fnameIn, const char* fnameOut)
{
	ifstream fin(fnameIn);
	
	int caseCount;
	fin >> caseCount;

	ofstream fout(fnameOut);

	for (int i=0; i<caseCount; i++)
	{
		fin >> N >> K >> B >> T;

		X.clear();
		V.clear();

		for (int n=0; n<N; n++)
		{
			int xn;
			fin >>xn;
			X.push_back(xn);
		}

		for (int n=0; n<N; n++)
		{
			int vn;
			fin >>vn;
			V.push_back(vn);
		}

		int r =Solve();

		fout<<"Case #"<<i+1<<": ";
		
		if (r<0)
			fout<< "IMPOSSIBLE";
		else
			fout<< r;
		
		fout<<"\n";
	}
}

//int main(int argc, int argv[])
//{
//	RunB("B-small-practice.in", "B-small-practice.out");
//	RunB("B-large-practice.in", "B-large-practice.out");
//
//	return 0;
//}


